package com.mall.controller;


import com.mall.pojo.GoodsCategoryPo;
import com.mall.service.GoodsCategoryService;
import com.mall.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 类目表 前端控制器
 * </p>
 *
 * @author zhangshiqi
 * @since 2020-09-13
 */
@RestController
@RequestMapping("/goodsCategory/")
public class GoodsCategoryController {

    @Autowired
    private GoodsCategoryService goodsCategoryService;

    /**
     * 查询所有类目信息
     */
    @RequestMapping("doFindObjects")
    public SysResult doFindObjects() {
        return SysResult.success(goodsCategoryService.doFindObjects());
    }

    /**
     * 查询所有ztree节点信息
     */
    @RequestMapping("doFindZTreeNodes")
    public SysResult doFindZTreeNodes() {
        return SysResult.success(goodsCategoryService.doFindZTreeNodes());
    }

    /**
     * 保存类目信息
     */
    @RequestMapping("doSaveObject")
    public SysResult doSaveObject(GoodsCategoryPo goodsCategoryPo) {
        goodsCategoryService.doSaveObject(goodsCategoryPo);
        return SysResult.success();
    }

    /**
     * 删除类目信息
     */
    @RequestMapping("doDeleteObject")
    public SysResult doDeleteObject(Integer id) {
        goodsCategoryService.doDeleteObject(id);
        return SysResult.success();
    }

    /**
     * 修改类目信息
     */
    @RequestMapping("doUpdateObject")
    public SysResult doUpdateObject(GoodsCategoryPo goodsCategoryPo) {
        goodsCategoryService.doUpdateObject(goodsCategoryPo);
        return SysResult.success();
    }

}

